//
//  UIButton+category.m
//  QQplayground
//
//  Created by 王昭的Mac Air on 2018/6/10.
//  Copyright © 2018年 zhang. All rights reserved.
//

#import "UIButton+category.h"

@implementation UIButton (category)

- (void)attributeFont:(UIFont *)font textColor:(UIColor *)textColor backgroundColor:(UIColor *)backgroundColor
{
    self.titleLabel.font = font;
    [self setTitleColor:textColor forState:0];
    
    if (backgroundColor) {
        [self setBackgroundColor:backgroundColor];
    }
}

//button 有边框，文字颜色，背景色为白色
- (void)attributeFont:(UIFont *)font textColor:(UIColor *)textColor borderWidth:(CGFloat)borderWidth borderColor:(UIColor *)borderColor radius:(CGFloat)radius
{
    self.backgroundColor = [UIColor whiteColor];
    self.titleLabel.font = font;
    [self setTitleColor:textColor forState:0];
    self.layer.borderWidth = borderWidth;
    self.layer.borderColor = borderColor.CGColor;
    self.layer.cornerRadius = radius;
}

//button 无边框，文字颜色，有背景色
- (void)attributeFont:(UIFont *)font textColor:(UIColor *)textColor radius:(CGFloat)radius background:(UIColor *)backgroundColor
{
    self.titleLabel.font = font;
    [self setTitleColor:textColor forState:0];
    self.layer.cornerRadius = radius;
    self.backgroundColor = backgroundColor;
}

@end
